#version 450
#extension GL_ARB_separate_shader_objects : enable

layout(binding = 0) uniform UniformBufferObject {
    mat4 projection;
	mat4 model;
	mat4 invModel;
} ubo;

layout (location = 0) in vec3 inPos;
layout (location = 1) in vec3 inNormal;

layout (location = 0) out vec3 outPos;
layout (location = 1) out vec3 outNormal;

layout (constant_id = 0) const int type = 0;

void main() {

	switch(type)
	{
		case 0: // skybox
			// skybox no translate
			outPos = vec3(mat3(ubo.model) * inPos);
			gl_Position = ubo.projection * vec4(outPos, 1.0);
			outNormal = inPos;
			// Convert cubemap coordinates into Vulkan coordinate space
			outNormal.xy *= -1.0;
			break;
		case 1: // object
			gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
			outNormal = mat3(ubo.model) * inNormal;
			break;
	}

	outPos = vec3(ubo.model * vec4(inPos, 1.0));
	
}